<?php

namespace app\admin\controller\store;


use app\common\controller\AdminController;
use app\common\service\store\SeckillConfigService;
use EasyAdmin\annotation\ControllerAnnotation;
use EasyAdmin\annotation\NodeAnotation;
use think\App;

/**
 * @ControllerAnnotation(title="seckill_config")
 */
class SeckillConfig extends AdminController
{

    use \app\admin\traits\Curd;

    public function __construct(App $app)
    {
        parent::__construct($app);

        $this->model = new \app\admin\model\store\SeckillConfig();

    }

    public function add()
    {
        if ($this->request->isAjax()) {
            $post = $this->request->post();
            $rule = [
                'title'=>'require',
                'start_time'=>'require',
                'end_time'=>'require'
            ];
            $this->validate($post, $rule);
            $info = SeckillConfigService::save($post);
            return json($info);
        }
        return $this->fetch();
    }


}